******************************************************************************
******************************************************************************
*** Replication Files for Competition, Aid, and Violence against Civilians ***
*** Authors: Yooneui Kim & Elizabeth J. Menninga						   ***
*** Accepted to International Interactions 2020					    	   ***
*** Analysis Run Using Stata 16											   ***
******************************************************************************
******************************************************************************

/*Loading and Preparing the Data*/
use "KimMenninga_2020_II_Replication.dta", clear


set more off
xtset dyad_id year


/*Descriptive Statistics in Table 1*/
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ  l.lnoda c.r2p##c.l.ln_civ ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce(cluster donor) ll(0)
*Looking only at observations included in the analyses 
sum lnoda ln_civ ln_count_cd ln_competitors_num d_exportshare_in_r ln_rival_aid r2p ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv if e(sample), detail
sum year if e(sample)


/*Analyses in Table 2*/
*Stage 3: DV=Aid; IV=deaths
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ c.ln_rival_aid##c.l.ln_civ  l.lnoda  c.r2p##c.l.ln_civ  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv pfail_reg civ_res if Russia_pre2011==0, vce(cluster donor) ll(0)
estimates store model1

*Stage 3: DV=Aid; IV=events
tobit lnoda c.l.ln_count_cd##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_count_cd c.ln_rival_aid##c.l.ln_count_cd  l.lnoda  c.r2p##c.l.ln_count_cd  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv pfail_reg count_res if Russia_pre2011==0, vce(cluster donor) ll(0)
estimates store model2

*Table 2
esttab model1 model2 using table2.rtf, b(3) compress ///
		 se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 
 
/*Marginal Effects, Model 1: Figures 1-6*/
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce(cluster donor) ll(0)

sum competitors_number  if e(sample), detail
sum ln_competitors_num  if e(sample), detail
sum ln_civ  if e(sample), detail

*Figure 1: Marginal Effect by Number of Competitors 
margins, dydx(l.ln_civ) at (ln_competitors_num =(0(.5)3) ln_rival_aid=(0) d_exportshare=(0) r2p =(1)) 
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xlabel(0 "0" 1.10 "2" 1.61 "4" 1.95 "6" 2.20 "8" 2.40 "10" 2.56 "12" 2.71 "14" 2.94 "18") ///
  ylabel(-.2 (.1) .1, nogrid) ///
  xtitle("Number of Competitors") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.")

margins, dydx(l.ln_civ) at (ln_competitors_num =(0 2.4) ln_rival_aid=(0) d_exportshare=(0) r2p=(1) cwardummy=(0) colony=(0)) 

*Figure 2 Substantive Effect of VaC by Number of Competitors
margins, predict(e(0, .)) at (l.ln_civ=(0 13.1) ln_competitors_num =(0 2.56 2.94) ln_rival_aid=(0) d_exportshare=(0) r2p=(1) cwardummy=(0) colony=(0)) saving(temp, replace)
use temp, clear
twoway (rcap _ci_lb _ci_ub _at, color(black) xtitle("") xmtick() xlabel(2 "Log Civilian Deaths=0" 5 "Log Civilian Deaths=13.1") ytitle("") ylabel(0(4)16) graphregion(color(white)) ytitle("Ln(Aid Allocations)")) ///
  (bar _margin _at if _at==1 | _at==4, fc("gs12") barwidth(.85)   legend(order(2 3 4) pos(11) ring(0) label(2 "Competitors=0") label(3 "Competitors=12") label(4 "Competitors=18") cols(1) region(lcolor(none) fcolor(none)) size(small))) ///
  (bar _margin _at if _at==2 | _at==5, fc("gs8") barwidth(.85)) ///
  (bar _margin _at if _at==3 | _at==6, fc("gs4") barwidth(.85)) ///
  (rcap _ci_lb _ci_ub _at, color(black))
  

*Figure 3 Marginal Effect of Export Share  
use "KimMenninga_2020_II_Replication.dta", clear
xtset dyad_id year

tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce(cluster donor) ll(0)

margins, dydx(d_exportshare_in_r) at (d_exportshare_in_r=(0(.1)1) ln_rival_aid=(0) ln_competitors_num=(0) r2p =(1))
marginsplot, plotopts(msymbol(i) color(black) lpattern(solid))  ciopts(msymbol(i) color(gs10) recast(rconnected) lpattern(solid))  ///
  xmtick(0(.1)1) ///
  ylabel(-10 (5) 15) ///
  xtitle("Export Share") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
    
*Figure 4 Marginal Effect of Civilian Deaths by Export Share 
margins, dydx(l.ln_civ) at (d_exportshare_in_r = (0(.1)1) ln_competitors_num=(0) ln_rival_aid=(0) r2p = (1))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xmtick(0(.1)1) ///
  ylabel(-.4 (.1) .3, nogrid) ///
  xtitle("Export Share") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

*Figure 5 Marginal Effect of Civilian Deaths Across Rival Aid 
margins, dydx(l.ln_civ) at (d_exportshare_in_r = (0) ln_competitors_num=(0) ln_rival_aid=(0(1)10) r2p=(1))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  ylabel(-.5 (.1) 0, nogrid) ///
  xtitle("Ln(Rival Aid)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

*Figure 6 Marginal Effect of Rival Aid Across Logged Civilian Deaths 
margins, dydx(ln_rival_aid) at (d_exportshare_in_r = (0) ln_competitors_num=(0) l.ln_civ=(0(1)13) r2p=(1))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  ylabel(-.3 (.1) .3, nogrid) ///
  xtitle("Ln(Civilian Deaths)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
 
/*Footnotes in Main Text*/
*Correlation between key IVs (footnotes 15 & 16)
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ  l.lnoda c.r2p##c.l.ln_civ ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0,vce(cluster donor) ll(0)
pwcorr ln_civ ln_count_cd if e(sample)
pwcorr ln_competitors_num d_exportshare_in_r ln_rival_aid if e(sample)

*Granger Causality (footnote 20)
pvar lnoda ln_civ
pvargranger

pvar lnoda ln_count_cd
pvargranger
 
 
**********************************************
**********************************************
*** Models Reported in the Online Appendix ***
**********************************************
**********************************************

/*Section 1: Distribution of Key Variables: Figures A1-A3 & Table A1*/
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ  l.lnoda c.r2p##c.l.ln_civ ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce(cluster donor) ll(0)
predict p1 if e(sample)==1
drop if p1 == .
collapse donor_number deaths_civilians count_cd, by (r_year) 

hist donor_number, bin(15) freq ///
  xtitle("Number of Donors by Recipient Year") ///
  title("") ///
  graphregion(color(white)) 
  
use "KimMenninga_2020_II_Replication.dta", clear
xtset dyad_id year
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce (cluster donor) ll(0)
predict p1 if e(sample)==1
drop if p1 == .

hist d_exportshare_in_r, bin(20) freq ///
  xtitle("Donor's Export Share in Recipient by Dyad Year") ///
  title("") ///
  graphregion(color(white)) 

hist rival_aid, freq  ///
  xtitle("Rival Aid to Recipient by Dyad Year") ///
  title("") ///
  graphregion(color(white)) 

*Table A1
use "KimMenninga_2020_II_Replication.dta", clear
xtset dyad_id year
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce (cluster donor) ll(0)
sum oda_nonneg deaths_civilians count_cd competitors_number r_gdppc_missing rebviolence if e(sample), detail


/*Section 2: Pfail & VaC as DV Models (First Stages): Tables A2 & A3*/

*Table A2
*Stage 1: DV=Leadership failure
probit wfail2 lnodagdp_nondem tlnodagdp_nondem lnodagdp_dem tlnodagdp_dem dem_dum lnt l.growth l.lntrade intensity CENTAM SAM EASTEU SSA ME CENTAS SEAS 
*predict pfail3, p

*reg wfail2 lnodagdp_nondem tlnodagdp_nondem lnodagdp_dem tlnodagdp_dem dem_dum lnt l.growth l.lntrade intensity CENTAM SAM EASTEU SSA ME CENTAS SEAS 
*predict pfail_reg, residual

*Table A3
*Stage 2: DV=Civilian Deaths 
reg ln_civ pfail3 c.r_polity2##c.r_polity2 cwardummy l.ln_civ ln_rebv ln_gdppc_missing r_infmort_missing, cluster(donor)
*predict civ_res, residual
estimates store model1
reg ln_count_cd pfail3 c.r_polity2##c.r_polity2 cwardummy l.ln_count_cd ln_rebv ln_gdppc_missing r_infmort_missing, cluster(donor)
*predict count_res, residual
estimates store model2

esttab model1 model2 using tableA3.rtf, b(3) compress ///
		se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 

/*Section 3: Alternative Operationalizations of Key Variables: Tables A4 & A5, Figure A4*/

*Table A4: unlogged # of competitors
tobit lnoda c.l.ln_civ##c.competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ l.lnoda c.r2p##c.l.ln_civ  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg civ_res if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store model1

tobit lnoda c.l.ln_count_cd##c.competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_count_cd  c.ln_rival_aid##c.l.ln_count_cd l.lnoda c.r2p##c.l.ln_count_cd  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg count_res if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store model2

esttab model1 model2 using tableA4.rtf, b(3) compress ///
		se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 

*Figure A4a
tobit lnoda c.l.ln_civ##c.competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce (cluster donor) ll(0)
margins, dydx(l.ln_civ) at (competitors_num = (0(1)29) d_exportshare_in_r=(0) ln_rival_aid=(0))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  ylabel(-.3 (.1) .2, nogrid) ///
  xtitle("Number of Competitors") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
  
*Figure A4b
tobit lnoda c.l.ln_count_cd##c.competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_count_cd  c.ln_rival_aid##c.l.ln_count_cd l.lnoda c.r2p##c.l.ln_count_cd  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg count_res if Russia_pre2011==0, vce (cluster donor) ll(0)
margins, dydx(l.ln_count_cd) at (competitors_num = (0(1)29) d_exportshare_in_r=(0) ln_rival_aid=(0))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  ylabel(-.3 (.1) .2, nogrid) ///
  xtitle("Number of Competitors") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

   
*Table A5: Alternative HRs Measures
tobit lnoda c.l.r_latentmean_rv##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.r_latentmean_rv  c.ln_rival_aid##c.l.r_latentmean_rv l.lnoda c.r2p##c.l.r_latentmean_rv  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg r_latentmen_res if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store A5a

tobit lnoda c.l.r_physint_rv##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.r_physint_rv  c.ln_rival_aid##c.l.r_physint_rv l.lnoda c.r2p##c.l.r_physint_rv  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv pfail_reg r_physint_res if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store A5b

esttab A5a A5b using tableA5.rtf, b(3) compress ///
		 se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 

/*Section 4: Model Specification: Tables A6-A8 & Figures A5-A11*/

*Table A6a: Donor HR
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ l.lnoda c.r2p##c.l.ln_civ  ln_gdppc_missing r_infmort_missing r_polity2 c.l.ln_civ##c.d_latentmean_fa unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg civ_res if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store A6a

*Figure A5: Rivalry & Civilian Deaths
margins, dydx(l.ln_civ) at (ln_rival=(0(1)10) ln_competitors_num=(0) d_exportshare_in_r=(0))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Rival Aid)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
  
*Figure A6: Marginal Effect of Donor HR by Civlian Deaths
margins, dydx(d_latentmean_fa) at (l.ln_civ=(0(1)13))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Civilian Deaths)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

  
*Table A6b: Amount of aid from competitors
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.l.ln_civ##c.ln_aid_comp c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store A6b


*Figure A7: Competition & Civilian Deaths
margins, dydx(l.ln_civ) at (ln_rival=(0) d_exportshare_in_r=(0) ln_aid_comp=(0(1)10))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Aid from Competitors)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

*Table A6c: 0=major donor; 1=moderate donor; 2= minor donor
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.l.ln_civ##i.major_donor c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv civ_res pfail_reg if Russia_pre2011==0, vce (cluster donor) ll(0)
estimates store A6c

esttab A6a A6b A6c using tableA6.rtf, b(3) compress ///
		 se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 


*Figure A8: Major Donor & Civilian Deaths
margins, dydx(l.ln_civ) at (major_donor=(0 1 2))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xlabel(0 "Major Donor" 1 "Moderate Donor" 2 "Minor Donor") ///
  xtitle("") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
 
*Figure A9: Major Donor & Civilian Deaths by Number of donors
margins, dydx(l.ln_civ) at (ln_competitors_num=(0(1)3.4) major_donor=(0) )
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Number of Competitors)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

margins, dydx(l.ln_civ) at (ln_competitors_num=(0(1)3.4) major_donor=(1) )
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Number of Competitors)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
 
margins, dydx(l.ln_civ) at (ln_competitors_num=(0(1)3.4) major_donor=(2))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Number of Competitors)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
  
  
*Table A7: Dropping Outliers "Darlings"
sum competitors_num if e(sample), detail
*90 percentile=22
sum ryearoda if e(sample), detail
*1420

tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ l.lnoda c.r2p##c.l.ln_civ  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg civ_res if Russia_pre2011==0 & competitors_num<22, vce (cluster donor) ll(0)
estimates store A7a

tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ  c.ln_rival_aid##c.l.ln_civ c.r2p##c.l.ln_civ  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg civ_res if Russia_pre2011==0 & ryearoda<1420, vce (cluster donor) ll(0)
estimates store A7b

*Figure A10A
margins, dydx(l.ln_civ) at (ln_rival=(0) d_exportshare_in_r=(0) ln_competitors_num=(0(1)3.4)r2p=(1))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Aid from Competitors)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

tobit lnoda c.l.ln_count_cd##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_count_cd  c.ln_rival_aid##c.l.ln_count_cd l.lnoda c.r2p##c.l.ln_count_cd  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg count_res if Russia_pre2011==0 & competitors_num<22, vce (cluster donor) ll(0)
estimates store A7c

tobit lnoda c.l.ln_count_cd##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_count_cd  c.ln_rival_aid##c.l.ln_count_cd c.r2p##c.l.ln_count_cd  l.lnoda ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff colony cwardummy ln_rebv pfail_reg count_res if Russia_pre2011==0 & ryearoda<1420, vce (cluster donor) ll(0)
estimates store A7d

*Figure A10b
margins, dydx(l.ln_count_cd) at (ln_rival=(0) d_exportshare_in_r=(0) ln_competitors_num=(0(1)3.4))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  xtitle("Ln(Aid from Competitors)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 

*Table A7
esttab A7a A7b A7c A7d using tableA7.rtf, b(3) compress ///
		 se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 


		
*Table A8: Including Russia Pre-2011 as 0
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ c.ln_rival_aid##c.l.ln_civ  l.lnoda  c.r2p##c.l.ln_civ  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv pfail_reg civ_res, vce (cluster donor) ll(0)
estimates store A8a

tobit lnoda c.l.ln_count_cd##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_count_cd c.ln_rival_aid##c.l.ln_count_cd  l.lnoda  c.r2p##c.l.ln_count_cd  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv pfail_reg count_res, vce (cluster donor) ll(0)
estimates store A8b

esttab A8a A8b using tableA8.rtf, b(3) compress ///
		 se label replace cells(b(fmt(3) star) ///
		se(par)) starlevels(* .05)  ///
		varwidth(30) nonumbers collabels(, none) eqlabels(, none) 

		
*Figure A11 Marginal Effect by Rivals 
tobit lnoda c.l.ln_civ##c.ln_competitors_num c.d_exportshare_in_r##c.d_exportshare_in_r##c.l.ln_civ c.ln_rival_aid##c.l.ln_civ  l.lnoda  c.r2p##c.l.ln_civ  ln_gdppc_missing r_infmort_missing r_polity2 unsc natresource_rents_wb absidealdiff cwardummy colony ln_rebv pfail_reg civ_res, vce (cluster donor) ll(0)

margins, dydx(ln_rival_aid) at (l.ln_civ=(0(1)13))
marginsplot, recast(connected) recastci(rconnected) ///
  ci1opts(lw(medthin) color(gs10) ms(i)) ///
  plot1opts(color(black) ms(i)) ///
  ylabel(-.3 (.1) .3, nogrid) ///
  xtitle("Ln(Civilian Deaths)") ///
  ytitle("Marginal Effect on Logged Aid Allocation") ///
  title("") legend(off) ///
  graphregion(color(white)) ///
  note("Note: 95% Confidence Intervals reported.") 
  

